package com.box.ai;

import jakarta.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.springframework.ai.document.Document;
import org.springframework.ai.vectorstore.SearchRequest;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
public class Text {
    @Resource
    private VectorStore redisVectorStore;

    @Test
    public void testVectorStore(){
        String fileName = "addd.pdf";
        List<Document> theWorld = redisVectorStore.similaritySearch(SearchRequest.builder()
                .filterExpression("file_name == '"+fileName+"'")
                .query("redis")
                .build());
        for (Document document : theWorld) {
            System.out.println(document.getText());
        }
    }
}
